package com.example.service.impl;

import com.example.aop.MyLog;
import com.example.service.Cal;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;


@Service
@Slf4j
public class CalImpl implements Cal {
    int result;

    @Override
    public int add(int num1, int num2) {
//        System.out.println("add方法的参数是" + num1 + "," + num2);
        result =  num1 + num2;
        log.info("相加结果是：{}",result);
//        System.out.println("add方法的结果是:" + result);
        return result;
    }
    @MyLog
    @Override
    public int sub(int num1, int num2) {
//        System.out.println("sub方法的参数是" + num1 + "," + num2);
        result = num1 - num2;

//        System.out.println("sub方法的结果是:" + result);
        return result;
    }

    @Override
    public int mul(int num1, int num2) {
        result = num1*num2;
        return result;
    }

    @Override
    public int div(int num1, int num2) {
        result = num1/num2;
        return  result;
    }
}
